import request from "@/utils/request";

const MESSAGE_BASE_URL = "/message";

/**
 * 获取日志分页列表
 *
 * @param queryParams 查询参数
 */
export function getPage(queryParams) {
  return request({
    url: `${MESSAGE_BASE_URL}/page`,
    method: "get",
    params: queryParams,
  });
}

export function getHistoryPage(queryParams) {
  return request({
    url: `${MESSAGE_BASE_URL}/pageByVisitor`,
    method: "get",
    params: queryParams,
  });
}
//发送消息
export function sendMessage(data) {
  return request({
    url: `${MESSAGE_BASE_URL}/send`,
    method: "post",
    data: data,
  });
}

export function closeMessage(params) {
  return request({
    url: `${MESSAGE_BASE_URL}/message_close`,
    method: "get",
    params: params,
  });
}

//将消息置为已读
export function readMessage(visitorId) {
  return request({
    url: `${MESSAGE_BASE_URL}/readMessage/` + visitorId,
    method: "get",
  });
}
//客服撤回消息
export function withdrawMessage(messageId) {
  return request({
    url: `${MESSAGE_BASE_URL}/withdrawMessage/` + messageId,
    method: "get",
  });
}
